import http from "@/utils/request"

// 获取产品信息
export const getProductApi = () => http.get('/product/get_product',{
    // params
})
// 增加产品 
export const addProduct = (params:productParam) => http.post('/product/add_product',{
    category_id:params.category_id,
    productName:params.productName,
    price:params.price,
    description:params.description,
    inventory:params.inventory,
    imageUrl:params.imageUrl
})

// 删除商品
export const delProduct = (product_id:string) => http.get('/product/del_product',{
    params:{
        product_id
    }
})


// 修改商品
export const updateProduct = (params:productParam) => http.post('/product/update_product',{
    category_id:params.category_id,
    product_id:params.product_id,
    productName:params.productName,
    price:params.price,
    description:params.description,
    inventory:params.inventory,
    imageUrl:params.imageUrl
})
export const getOrderApi = () => http.post('/order/get_order')
// 获取类目信息
export const getCategory = () => http.get('/category/getCategory')

// 增加类目
export const addCategory = (params:productParam) => http.post('/category/addCategory',{
    categoryName:params.categoryName,
    categoryImgurl:params.categoryImgurl
})

// 删除类目
export const delCategory = (category_id:string) => http.get('/category/delCategory',{
    params:{
        category_id
    }
})

// 修改类目
export const updateCategory = (params:productParam) => http.post('/category/updateCategory',{
    categoryName:params.categoryName,
    categoryImgurl:params.categoryImgurl,
    category_id:params.category_id
})

